using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace UserManagement.Models;

[Table("t_user")]
public class User
{
    [Key]
    [Column("id")]
    public long Id { get; set; }
    
    [Required] 
    [MaxLength(32)] // 长度约束
    [Column("username", TypeName = "varchar(32)")]
    public required string Username { get; set; }
    
    [MaxLength(32)]
    [EmailAddress]
    [Column("email", TypeName = "varchar(32)")]
    public string? Email { get; set; }
    
    [Column("create_time", TypeName = "datetime")]
    public DateTime CreateTime { get; set; } = DateTime.Now;
}